package org.test.util;

import java.util.Properties;

/**
 * Created by Hy on 2018/7/13.
 */
public class PropsUtil {
    /**
     * 获取数值型属性（带有默认值）
     */
    public static int getNumber(Properties props,String key,int defaultValue){
        int value = 0;
        if(props.containsKey(key)){
            value = CastUtil.castInt(props.getProperty(key));
        }
        return value;
    }

    /**
     * 获取数值型属性
     */
    public static int getNumber(Properties props,String key){
        int value =0;
        if(props.contains(key)){
            value = CastUtil.castInt(props.getProperty(key));
        }
        return value;
    }
}
